<?php
/**
 * @Notes:【】
 * @Date: 2022-08-14 17:38
 */

namespace App\Event\Ocean;

class OceanNavigateTO
{
    /**
     * @var string 消息事件名
     */
    public $event_name;

    /**
     * @var array 消息数据
     */
    public $data;

    /**
     * @var string token
     */
    public $token;

    /**
     * @var int user_id
     */
    public $user_id;

    /**
     * TalkMessageEvent constructor.
     *
     * @param string $event_name
     * @param array $data
     */
    public function __construct(string $event_name, string $token, array $data = [])
    {
        $token = trim(ltrim($token, 'Bearer'));
        [$user_id] = App(\App\Util\JwtAuth::class)->parseToken($token);
        $this->user_id = $user_id;
        $this->token = $token;
        $this->event_name = $event_name;
        $this->data = $data;
    }

}